// 住院收费
<template>
  <el-row class="hospitalizedCharge-content" >
    <el-col :span="24">
      <el-col
        :span="24"
        class="pddTop hospitalizedCharge-right"
        style="padding: 0 10px; padding-top: 10px;overflow:hidding;min-height:75vh"
      >
    
        <div
          style="height: 75vh;
    overflow: auto;"
        >
 

          <ViewTitle text="转院信息" id="ruyuan" @click='closeitalization2' />
          <el-col :span="24" class="pddTop10" @click='hospitalization4'>
            <el-form
              :inline="false"
              class="form-demo"
              label-width="auto"
              v-model="menfrom"
            >
              <el-col :span="24">
               
             
                 <el-col :span="8">
                  <el-form-item label="转院类型:">
                    <el-select
                      v-model="menfrom.refl_type"
                      placeholder="转院类型"
                       :disabled='ifxiu'
                    >
                      <el-option
                        v-for="(item, index) in zhuanyuan"
                        :key="index"
                        :label="item.name"
                        :value="item.id"
                        >{{ item.name }}</el-option
                      >
                    </el-select>
                  
                  </el-form-item>
                </el-col>
                  <el-col :span="8">
                  <el-form-item label="转院医院名称:">
                     <div class="yisheng">
                      <el-popover
                        placement="bottom-end"
                        v-model="visiblePatient2"
                        trigger="focus"
                      >
                        <el-input
                          placeholder="转院医院名称"
                          slot="reference"
                          v-model="menfrom.reflin_medins_name"
                          size="mini"

                   
                          @input="getgetDiseaseDict"
                          style="height:40px"
                        >
                        </el-input>
                        <el-table
                          height="300"
                          ref="multipleTable"
                          :data="disease_list"
                          @row-click="handleSelectionChange"
                        >
         

                          <el-table-column
                            width=""
                            property="fixmedins_code"
                            label="编号"
                          ></el-table-column>

                          <el-table-column
                           
                            property="fixmedins_name"
                            label="名称"
                          ></el-table-column>
                          <el-table-column
                           
                            property="hosp_lv"
                            label="等级"
                          ></el-table-column>

                      
                        </el-table>
                      </el-popover>
                    </div>
                  </el-form-item>
                </el-col>
                  <el-col :span="8">
                  <el-form-item label="转往定点医药机构编号 :">
                    <el-input
                      placeholder="转往定点医药机构编号"
                      v-model="menfrom.reflin_medins_no"
                       disabled
                    >
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="就医地行政区划:">
                    <el-input
                      placeholder="就医地行政区划"
                      v-model="menfrom.mdtrtarea_admdvs"
                       :disabled='ifxiu'
                    >
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="转院时间:">
                    <el-date-picker
                      v-model="menfrom.refl_date"
                       :disabled='ifxiu'
                      type="date"
                      placeholder="选择日期"
                      format="yyyy 年 MM 月 dd 日"
                      value-format="yyyy-MM-dd"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="是否同意转院:">
                      <el-radio-group v-model="menfrom.hosp_agre_refl_flag">
      <el-radio label="1" value='1'>是</el-radio>
      <el-radio label="0" value='0'>否</el-radio>
    </el-radio-group>
                  </el-form-item>
                </el-col>

              </el-col>
                <el-col :span="24">
                  <el-form-item label="转院原因:">
                    <el-input placeholder="转院原因" 
                     :disabled='ifxiu' v-model="menfrom.refl_rea">
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="转院意见:">
                    <el-input placeholder="转院意见" 
                     :disabled='ifxiu' v-model="menfrom.refl_opnn">
                    </el-input>
                  </el-form-item>
                </el-col>
                 
             
             
            </el-form>
          </el-col>
      
        </div>
      </el-col>
    </el-col>
  
  </el-row>
</template>
<script>
import FromList from "@/forComponents/fromList/fromList";
import TopManu from "@/components/TopMenu";
import ViewTitle from "@/forComponents/viewTitle/index.vue";
import {

  getdictIndex,
 
} from "@/api/register";
import { hosTransferApply,getOrgInfo } from "@/api/zhuyanre";


let that;
export default {
    props: ['patientinfo'],
    // patientinfo: {
    //   type: Object,
    //   default: 0
    // }
  // },
  data() {
    return {
         
       visiblePatient2: false,
      //提交
      menfrom: {
       id:'',
       reflin_medins_no:'',
       reflin_medins_name:'',
       mdtrtarea_admdvs:'',
       hosp_agre_refl_flag:'1',
       refl_type:'',
       refl_date:'',
       refl_rea:'',//转院原因
       refl_opnn:'',//转院意见
       
      },
      zhuanyuan:[],
     
      ifxiu:false
    };
  },

  mounted() {
    that = this;
 this.getdiet_list()
// this.getgetDiseaseDict()
 this.menfrom.id=this.patientinfo.id
  },
  watch: {
    patientinfo(to) {
      this.patientinfo=to
  
    },
   
  },
  methods: {
   
  getdiet_list() {
      getdictIndex({ group_id: "24" })
        .then(arr => {
          let data = arr.data;

          data.forEach((item, key) => {
            if(item.id==24){
               
             that.zhuanyuan=item.items;
            }
            

           
          });
        })
        .catch(e => {});

    },
       getgetDiseaseDict(e) {
     
      getOrgInfo({fixmedins_name:this.menfrom.reflin_medins_name})
        .then(res => {
          let data = res.data.medinsinfo;
          console.log(data);
          that.disease_list = data;
    
        })
        .catch(e => {});
    },
      handleSelectionChange(val) {
        this.menfrom.reflin_medins_name=val.fixmedins_name
        this.menfrom.reflin_medins_no=val.fixmedins_code
         this.menfrom.mdtrtarea_admdvs=val.admdvs
         this.visiblePatient2 = false;
      },

    //提交住院信息
    hospitalization4() {
      var data = that.menfrom;

        this.$emit("hospitalization4", data);

    },
       mapxian(num) {
      var art = "";
      for (var i in that.xianzhong) {
        if (that.xianzhong[i].id == num) {
          art = that.xianzhong[i].value;
           return art;
        }
        console.log(art)
       

      }
    },
       mapyiliao(num) {
      var art = "";
      for (var i in that.yiliao) {
        if (that.yiliao[i].id == num) {
          art = that.yiliao[i].value;
        }
        return art;
      }
    },
       mapjiuzhen(num) {
      var art = "";
      for (var i in that.jiuzhen) {
        if (that.jiuzhen[i].id == num) {
          art = that.jiuzhen[i].value;
           return art;
        }
       
      }
    },
    closeitalization2(){
       this.$emit("closeitalization2");
    
       
    },
  

  },
  components: {
    FromList,
    TopManu,
    ViewTitle
  },

};
</script>

<style lang='scss' scoped>
@import "./index.scss";
</style>